/**
 * Created by Administrator on 2016/11/16.
 */
//json.dian     点击的元素
//json.img     点击的元素
hgNews.dianCollect = function(json){
    var i = 0;
    json.dian.on("click",function(){
        if (i==0){
            json.dian.find("img").attr("src","img/collect-3.png");
            layer.msg('收藏成功',{icon: 1});
            i = 1;
        }else {
            json.dian.find("img").attr("src","img/"+json.img);
            layer.msg('取消成功',{icon: 2});
            i = 0;
        }
        $.ajax({
            type:"post",
            url:todo,//todo
            data:todo,//todo
            dataType:"json",
            error: function (jqXHR, textStatus, errorThrown) {//进行错误信息的处理
                /*弹出jqXHR对象的信息*/
                console.log(jqXHR.responseText + "-" + jqXHR.status + "-" + jqXHR.readyState + "-" + jqXHR.statusText);
                /*弹出其他两个参数的信息*/
                console.log(textStatus);
                console.log(errorThrown);
            },
            success:function(data){
                if (data.status == 1){
                    //todo 效果
                }else {
                    alert("data.status="+data.status);
                }
            }
        });
    });
};
